package com.ogilvy.audi.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ogilvy.audi.bean.Topic;
import com.ogilvy.audi.dao.TopicDao;
import com.ogilvy.audi.service.TopicService;
import com.ogilvy.frame.page.PageTools;
import com.ogilvy.frame.service.BaseServiceImpl;

@Service
public class TopicServiceImpl extends BaseServiceImpl implements TopicService{
	@Autowired
	TopicDao topicDao;
	public PageTools<Topic> query(){
		return null;
	}
	public PageTools<Topic> query(int pageNo, int pageSize,Map<String,Object> condition){
		return topicDao.selectAll(pageNo, pageSize, condition);
	}
	public PageTools<Topic> query(Map<String,Object> condition){
		return topicDao.selectAll(condition);
	}
	public List<Topic> queryNewTopic(){
		return topicDao.selectNewTopic();
	}
	public Topic add(Topic topic){
		Topic o = topicDao.save(topic);
		return o!=null?o:null;
	}
	public boolean del(Integer topicId){
		Topic o = topicDao.deleteById(topicId);
		return o!=null?true:false;
	}
}
